package initialize

import (
	"fmt"
	"github.com/go-redis/redis"
)

var Rdb *redis.Client

type RedisConfig struct {
	Addr string
	Pwd  string
	Db   int
}

func InitRedis() {
	App := RedisConfig{
		Addr: "1.94.42.54:6379",
		Pwd:  "",
		Db:   0,
	}
	Rdb = redis.NewClient(&redis.Options{
		Addr:     App.Addr,
		Password: App.Pwd,
		DB:       App.Db,
	})
	result, err := Rdb.Ping().Result()
	if err != nil {
		panic("redis连接失败")
		return
	}
	fmt.Println("redis连接成功")
	fmt.Println(result)

}
